<?php

declare(strict_types=1);

namespace App\Controller\Admin;

use App\Controller\BaseController;
use Hyperf\HttpServer\Annotation\AutoController;

/**
 * @AutoController()
 */
class HomeController extends BaseController
{
    public function index()
    {
        $array = [
          [
              'order_no'    =>  (string)mt_rand(1,1000),
              'price'       =>  100.00,
              'row' =>  [
                  'order_no'    =>  mt_rand(1,1000)
              ],
              'status'      =>  mt_rand(1,1000) > 500 ? 'danger' : 'success'
          ],
            [
                'order_no'    => (string) mt_rand(1,1000),
                'price'       =>  100.00,
                'row' =>  [
                    'order_no'    =>  mt_rand(1,1000)
                ],
                'status'      =>  mt_rand(1,1000) > 500 ? 'danger' : 'success'
            ]
        ];

        $ip = $this->request->getHeader('remote_addr');

        return $this->success(['items' => $array]);
    }
}
